package messaging;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * Creates a token packet.
 * @author Team 4
 * @version 1th June 2013
 */
@SuppressWarnings("serial")
public class TokenPacket implements Serializable
{
  /**
   * Stores the node id which is starting the token request.
   */
  private final int my_node_id;
  /**
   * Stores the token type.
   */
  private final TokenType my_token_type;
  /**
   * Stores the first key.
   */
  private String my_first_key;
  /**
   * Stores the last key.
   */
  private String my_last_key;
  /**
   * Stores the node count.
   */
  private int my_key_count;
  /**
   * Stores the actual node count.
   */
  private ArrayList<Integer> my_actual_count = new ArrayList<>();
  /**
   * Instantiates node id and token type.
   * @param the_node_id : stores the node it
   * @param the_token_type : stores the token type
   */
  public TokenPacket(final int the_node_id, final TokenType the_token_type)
  {
    my_node_id = the_node_id;
    my_token_type = the_token_type;
  }
  /**
   * returns the node.
   * @return the node which has created this token
   */
  public int getMyNodeId()
  {
    return my_node_id;
  }
  /**
   * Returns the token type.
   * @return the type of this token
   */
  public TokenType getMyTokenType()
  {
    return my_token_type;
  }
  /**
   * Returns the first key.
   * @return the first key
   */
  public String getMyFirstKey()
  {
    return my_first_key;
  }
  /**
   * Sets the first key.
   * @param the_first_key stores the first key.
   */
  public void setMyFirstKey(final String the_first_key)
  {
    this.my_first_key = the_first_key;
  }
  /**
   * Returns the last key.
   * @return the last key.
   */
  public String getMyLastKey()
  {
    return my_last_key;
  }
  /**
   * Sets the last key.
   * @param the_last_key : the last key
   */
  public void setMyLastKey(final String the_last_key)
  {
    this.my_last_key = the_last_key;
  }
  /**
   * Returns the node count.
   * @return the number of nodes
   */
  public int getMyKeyCount()
  {
    return my_key_count;
  }
  /**
   * Sets the node count.
   * @param the_node_count stores the node count
   */
  public void setMyKeyCount(final int the_node_count)
  {
    this.my_key_count = the_node_count;
  }
  /**
   * Gets the actual node count.
   * @return the actual node count
   */
  public ArrayList<Integer> getMyActualCount()
  {
    return my_actual_count;
  }
  /**
   * Sets the actual node count.
   * @param the_actual_count stores the actual node count
   */
  public void setMyActualCount(final ArrayList<Integer> the_actual_count)
  {
    this.my_actual_count = the_actual_count;
  }  
}
